// Copyright 2022-present The ZTDBP Authors.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//     http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs

import (
	"bytes"
	"encoding/json"
	"strings"
	"text/template"

	"github.com/swaggo/swag"
)

var doc = `{
    "schemes": {{ marshal .Schemes }},
    "swagger": "2.0",
    "info": {
        "description": "{{escape .Description}}",
        "title": "{{.Title}}",
        "contact": {},
        "version": "{{.Version}}"
    },
    "host": "{{.Host}}",
    "basePath": "{{.BasePath}}",
    "paths": {
        "/a/{hash}": {
            "get": {
                "description": "机器鉴权",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA ControlPlane"
                ],
                "summary": "MachineOauth",
                "parameters": [
                    {
                        "type": "string",
                        "description": "hash",
                        "name": "hash",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/client": {
            "get": {
                "description": "获取ZTA的client",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "ClientList",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "put": {
                "description": "修改ZTA的client",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "EditClient",
                "parameters": [
                    {
                        "description": "修改ZTA的client",
                        "name": "Client",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.EditClient"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "post": {
                "description": "新增ZTA的client",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "AddClient",
                "parameters": [
                    {
                        "description": "新增ZTA的client",
                        "name": "Client",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.AddClient"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/client/{uuid}": {
            "delete": {
                "description": "删除ZTA的client",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "DelClient",
                "parameters": [
                    {
                        "type": "string",
                        "description": "uuid",
                        "name": "uuid",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/relay": {
            "get": {
                "description": "获取ZTA的relay",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "RelayList",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "put": {
                "description": "修改ZTA的relay",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "EditRelay",
                "parameters": [
                    {
                        "description": "修改ZTA的relay",
                        "name": "Relay",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.EditRelay"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "post": {
                "description": "新增ZTA的relay",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "AddRelay",
                "parameters": [
                    {
                        "description": "新增ZTA的relay",
                        "name": "Relay",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.AddRelay"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/relay/{uuid}": {
            "delete": {
                "description": "删除ZTA的relay",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "DelRelay",
                "parameters": [
                    {
                        "type": "string",
                        "description": "uuid",
                        "name": "uuid",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/resource": {
            "get": {
                "description": "获取ZTA的resource",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "ResourceList",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "put": {
                "description": "修改ZTA的resource",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "EditResource",
                "parameters": [
                    {
                        "description": "修改ZTA的resource",
                        "name": "Resource",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.EditResource"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "post": {
                "description": "新增ZTA的resource",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "AddResource",
                "parameters": [
                    {
                        "description": "新增ZTA的resource",
                        "name": "Resource",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.AddResource"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/resource/{uuid}": {
            "delete": {
                "description": "删除ZTA的resource",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "DelResource",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "主键ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/server": {
            "get": {
                "description": "获取ZTA的server",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "ServerList",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "put": {
                "description": "修改ZTA的server",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "EditServer",
                "parameters": [
                    {
                        "description": "修改ZTA的server",
                        "name": "Server",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.EditServer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "post": {
                "description": "新增ZTA的server",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "AddServer",
                "parameters": [
                    {
                        "description": "新增ZTA的server",
                        "name": "Server",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.AddServer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/access/server/{uuid}": {
            "delete": {
                "description": "删除ZTA的server",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA"
                ],
                "summary": "DelServer",
                "parameters": [
                    {
                        "type": "string",
                        "description": "uuid",
                        "name": "uuid",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/controlplane/machine/{machine_id}": {
            "get": {
                "description": "根据机器码获取客户端鉴权的url",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA ControlPlane"
                ],
                "summary": "LoginUrl",
                "parameters": [
                    {
                        "type": "string",
                        "description": "machine_id",
                        "name": "machine_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/machine/auth/poll": {
            "get": {
                "description": "机器鉴权",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA ControlPlane"
                ],
                "summary": "MachineOauth",
                "parameters": [
                    {
                        "type": "string",
                        "description": "轮询的主题",
                        "name": "category",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "description": "超时时间，单位：秒",
                        "name": "timeout",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/sysytem/oauth2": {
            "get": {
                "description": "获取ZTA的Oauth2",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA Oauth2"
                ],
                "summary": "ListOauth2",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "put": {
                "description": "修改ZTA的Oauth2",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA Oauth2"
                ],
                "summary": "EditOauth2",
                "parameters": [
                    {
                        "description": "修改ZTA的Oauth2",
                        "name": "Oauth2",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.EditOauth2"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            },
            "post": {
                "description": "新增ZTA的Oauth2",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA Oauth2"
                ],
                "summary": "AddOauth2",
                "parameters": [
                    {
                        "description": "新增ZTA的Oauth2",
                        "name": "Oauth2",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/mparam.AddOauth2"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        },
        "/sysytem/oauth2/{id}": {
            "delete": {
                "description": "删除ZTA的Oauth2",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "ZTA Oauth2"
                ],
                "summary": "DelOauth2",
                "parameters": [
                    {
                        "type": "integer",
                        "description": "主键ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/controller.Res"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "controller.Res": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "data": {
                    "type": "object"
                },
                "message": {
                    "type": "string"
                }
            }
        },
        "mmysql.ClientTarget": {
            "type": "object",
            "required": [
                "host",
                "port"
            ],
            "properties": {
                "host": {
                    "type": "string"
                },
                "port": {
                    "type": "integer"
                }
            }
        },
        "mparam.AddClient": {
            "type": "object",
            "required": [
                "expire",
                "name",
                "port",
                "server_id",
                "target"
            ],
            "properties": {
                "expire": {
                    "description": "过期时间：天",
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                },
                "server_id": {
                    "type": "integer"
                },
                "target": {
                    "$ref": "#/definitions/mmysql.ClientTarget"
                }
            }
        },
        "mparam.AddOauth2": {
            "type": "object",
            "required": [
                "auth_url",
                "client_id",
                "client_secret",
                "name",
                "redirect_url",
                "scopes",
                "token_url"
            ],
            "properties": {
                "auth_url": {
                    "type": "string"
                },
                "client_id": {
                    "type": "string"
                },
                "client_secret": {
                    "type": "string"
                },
                "name": {
                    "type": "string",
                    "enum": [
                        "github",
                        "facebook",
                        "google"
                    ]
                },
                "redirect_url": {
                    "type": "string"
                },
                "scopes": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "token_url": {
                    "type": "string"
                }
            }
        },
        "mparam.AddRelay": {
            "type": "object",
            "required": [
                "host",
                "name",
                "out_port",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com",
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "out_port": {
                    "description": "443",
                    "type": "integer"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                }
            }
        },
        "mparam.AddResource": {
            "type": "object",
            "required": [
                "host",
                "name",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com,192.168.1.1/16",
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "port": {
                    "description": "80-443;3306;6379",
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "cidr",
                        "dns"
                    ]
                }
            }
        },
        "mparam.AddServer": {
            "type": "object",
            "required": [
                "host",
                "name",
                "out_port",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com",
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "out_port": {
                    "description": "443",
                    "type": "integer"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                },
                "resource_id": {
                    "type": "string"
                }
            }
        },
        "mparam.EditClient": {
            "type": "object",
            "required": [
                "expire",
                "id",
                "name",
                "port",
                "server_id",
                "target"
            ],
            "properties": {
                "expire": {
                    "description": "过期时间：天",
                    "type": "integer"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                },
                "server_id": {
                    "type": "integer"
                },
                "target": {
                    "$ref": "#/definitions/mmysql.ClientTarget"
                }
            }
        },
        "mparam.EditOauth2": {
            "type": "object",
            "required": [
                "auth_url",
                "client_id",
                "client_secret",
                "id",
                "name",
                "redirect_url",
                "scopes",
                "token_url"
            ],
            "properties": {
                "auth_url": {
                    "type": "string"
                },
                "client_id": {
                    "type": "string"
                },
                "client_secret": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string",
                    "enum": [
                        "github",
                        "facebook",
                        "google"
                    ]
                },
                "redirect_url": {
                    "type": "string"
                },
                "scopes": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "token_url": {
                    "type": "string"
                }
            }
        },
        "mparam.EditRelay": {
            "type": "object",
            "required": [
                "host",
                "id",
                "name",
                "out_port",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com",
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "out_port": {
                    "description": "443",
                    "type": "integer"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                }
            }
        },
        "mparam.EditResource": {
            "type": "object",
            "required": [
                "host",
                "id",
                "name",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com,192.168.1.1/16",
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "port": {
                    "description": "80-443;3306;6379",
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "cidr",
                        "dns"
                    ]
                }
            }
        },
        "mparam.EditServer": {
            "type": "object",
            "required": [
                "host",
                "id",
                "name",
                "out_port",
                "port"
            ],
            "properties": {
                "host": {
                    "description": "api.github.com",
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "out_port": {
                    "description": "443",
                    "type": "integer"
                },
                "port": {
                    "description": "443",
                    "type": "integer"
                },
                "resource_id": {
                    "type": "string"
                }
            }
        }
    }
}`

type swaggerInfo struct {
	Version     string
	Host        string
	BasePath    string
	Schemes     []string
	Title       string
	Description string
}

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
	Version:     "1.0.0",
	Host:        "127.0.0.1:80",
	BasePath:    "/api/v1",
	Schemes:     []string{},
	Title:       "ZAManager API",
	Description: "This is ZAManager api list.",
}

type s struct{}

func (s *s) ReadDoc() string {
	sInfo := SwaggerInfo
	sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)

	t, err := template.New("swagger_info").Funcs(template.FuncMap{
		"marshal": func(v interface{}) string {
			a, _ := json.Marshal(v)
			return string(a)
		},
		"escape": func(v interface{}) string {
			// escape tabs
			str := strings.Replace(v.(string), "\t", "\\t", -1)
			// replace " with \", and if that results in \\", replace that with \\\"
			str = strings.Replace(str, "\"", "\\\"", -1)
			return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
		},
	}).Parse(doc)
	if err != nil {
		return doc
	}

	var tpl bytes.Buffer
	if err := t.Execute(&tpl, sInfo); err != nil {
		return doc
	}

	return tpl.String()
}

func init() {
	swag.Register("swagger", &s{})
}
